﻿using System;
using System.IO;
using System.Text;

namespace program6
{
  internal class Program
    {
      private static void Main(string[] args)
        {
            //使用FileStream拉写入文件
            //    using (FileStream fsWrite = new FileStream("new.text", FileMode.OpenOrCreate, FileAccess.Write))
            //    {
            //        var str = "看我把你覆盖掉！";
            //        //把字符串转换成二进制
            //        byte[] buffer = Encoding.UTF8.GetBytes(str);
            //        fsWrite.Write(buffer, 0, buffer.Length);
            //    }
            //    Console.WriteLine("文件写入成功！");

            FileStream fsRead = new FileStream(@"D:\CsharpAdvanced\program6\bin\Debug\netcoreapp3.1\new.db", FileMode.OpenOrCreate,
                FileAccess.Read);
            byte[] buffer = new byte[1024 * 1024 * 5];
            int r = fsRead.Read(buffer, 0, buffer.Length);
            string str = Encoding.UTF8.GetString(buffer, 0, r);
            fsRead.Close();
            fsRead.Dispose();
            Console.WriteLine(str);
        }
        
    }
}
